local langgu = fk.CreateSkill {
  name = "lvshi__langgu",
}
Fk:loadTranslationTable{
  ["lvshi__langgu"] = "狼顾",
  [":lvshi__langgu"] = "你上家和下家角色的手牌对你可见；当你受到伤害后，你可获得一名其他角色区域里的一张牌。",
  ["#lvshi__langgu-choose"] = "狼顾：你可获得一名其他角色区域里的一张牌",

  ["$lvshi__langgu1"] = "洛水为誓，皇天为证，吾意不在刀兵。",
  ["$lvshi__langgu2"] = "以谋代战，攻形不以力，攻心不以勇。",
}

langgu:addEffect(fk.Damaged, {
  anim_type = "masochism",
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local to = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = 1,
      targets = table.filter(player.room:getOtherPlayers(player), function (p) return not p:isAllNude() end),
      skill_name = langgu.name,
      prompt = "#lvshi__langgu-choose",
      cancelable = true,
    })
    if #to > 0 then
      event:setCostData(self, {tos = to})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local to = event:getCostData(self).tos[1]
    if not to:isAllNude() then
      local id = player.room:askToChooseCard(player, {
        target = to,
        flag = "hej",
        skill_name = langgu.name,
      })
      player.room:obtainCard(player, id, false, fk.ReasonPrey, player, langgu.name)
    end
  end,
})

langgu:addEffect("visibility", {
  card_visible = function(self, player, card)
    if player:hasSkill(self) and Fk:currentRoom():getCardArea(card) == Card.PlayerHand then
      local target = Fk:currentRoom():getCardOwner(card)
      if target and (player:getNextAlive() == target or target:getNextAlive() == player) then
        return true
      end
    end
  end,
})

return langgu